#include<iostream>

using namespace std;

bool plan(int sum)
{
	int af = 0;
	int i = sum;
	int k = 100000;
	while (i != 0)
	{
		af += (i % 10) * k;
		i /= 10;
		k /= 10;
	}
	if (sum == af)
	{
		return true;
	}
	return false;
}

int main()
{
	int a, b, c, d;
	int sum;
	for (int a = 3; a < 10; a++)      
	{
		for (int b = 0; b < 10; b++)
		{
			for (int c = 0; c < 10; c++)
			{
				int besu = a * 10000 + b * 1000 + c * 100 + a * 10 + b;
				sum = besu * a;
				bool x = plan(sum);
				if (x)
				{
					cout << sum << endl;
				}
			}
		}
	}
	return 0;
}